package shiro.util;

import org.apache.shiro.crypto.hash.Md5Hash;

public class Md5Util {

    // md5
    public static String getMd5(String str) {
        Md5Hash md5Hash = new Md5Hash(str);
        System.out.println(md5Hash.toHex());
        return md5Hash.toHex();
    }

    // md5 + salt
    public static String getMd5(String str, String salt) {
        Md5Hash md5Hash = new Md5Hash(str, salt);
        System.out.println(md5Hash.toHex());
        return md5Hash.toHex();
    }

    // md5 + salt + hash
    public static String getMd5(String str, String salt, int hashIterations) {
        Md5Hash md5Hash = new Md5Hash(str, salt, hashIterations);
        System.out.println(md5Hash.toHex());
        return md5Hash.toHex();
    }


}
